import { useEffect, useState } from "react"

console.log('good external')

const GoodPage = ({
  location,
  history,
}) => {
  const [data, setData] = useState('')
  console.log(location)
  console.log('good')
  const back = () => {
    history.go(-1)
  }
  const toHome = () => {
    history.push({
      pathname: '/',
    })
  }
  const change = () => {
    console.log('change')
    history.push({
      pathname: '/good',
      search: 'name=mary&age=136546' + new Date().getTime()
    })
    // window.history.pushState({}, null, "?name=mary&age=1364" + new Date().getTime());
  }
  const changeData = () => {
    setData('hahaha')
  }

  useEffect(() => {
    console.log('effect')
  }, [location.search])
  return (
    <div>
    <button onClick={back}>goback</button>
      <button onClick={change}>changeGood</button>
      <button onClick={changeData}>changeData</button>
      <button onClick={toHome}>toHome</button>
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      <img style={{width: '300px'}} src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg9.51tietu.net%2Fpic%2F2019-091406%2Feycyg1dmdpqeycyg1dmdpq.jpg&refer=http%3A%2F%2Fimg9.51tietu.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637824901&t=e6737c910663d5d2dfdef66526532bab" alt="jj" />
      {data}
      

    </div>
  )
}

export default GoodPage